package com.sc.test.dagger2;

import javax.inject.Named;

import dagger.Module;
import dagger.Provides;

/**
 * Created by Shen Chao.
 * Created on 2018-06-02-002.
 */
@Module
public class Dagger2Module {
    @Provides
    public Cloth getCloth() {
        Cloth cloth = new Cloth();
        cloth.setColor("红色");
        return cloth;
    }

    @Provides
    @RedCloth
    public Cloth getRedCloth() {
        Cloth cloth = new Cloth();
        cloth.setColor("红色");
        return cloth;
    }

    @Provides
    @Named("blue")
    @PerActivity
//    @Singleton
    public Cloth getBlueCloth() {
        Cloth cloth = new Cloth();
        cloth.setColor("蓝色");
        return cloth;
    }

    @Provides
    public Clothes getClothes(@Named("blue") Cloth cloth) {
        return new Clothes(cloth);
    }

//    @Provides
//    @PerActivity
//    public ClothHandler getClothHandler() {
//        return new ClothHandler();
//    }
}
